package com.wjw.java.games.tankgame3;

/**
 * 坦克类：父类
 */
public class Tank {
    private int x;//坦克的横坐标
    private int y;//坦克的纵坐标
    private int direction = 0;//坦克的朝向(0上、1右、2下、3左)顺时针
    private int speed = 1;//移动速度,位移几像素

    public int getX() {
        return this.x;
    }

    public void setX(int x) {
        this.x = x;
    }

    public int getY() {
        return this.y;
    }

    public void setY(int y) {
        this.y = y;
    }

    public int getDirection() {
        return this.direction;
    }

    public void setDirection(int direction) {
        this.direction = direction;
    }

    public int getSpeed() {
        return this.speed;
    }

    public void setSpeed(int speed) {
        this.speed = speed;
    }

    public Tank(int x, int y) {
        this.x = x;
        this.y = y;
    }

    //W向上移动
    public void moveUp(){
        this.y -= speed;
    }

    //D向右移动
    public void moveRight(){
        this.x += speed;
    }

    //S向下移动
    public void moveDown(){
        this.y += speed;
    }

    //A向左移动
    public void moveLeft(){
        this.x -= speed;
    }
}
